﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace PublicModelsAndEntities.Entities.Connection
{
    /// <summary>
    /// 主程序参数
    /// </summary>
    [XmlType(TypeName = "配置信息")]
    public class MainProgramParam
    {
        /// <summary>
        /// 连接参数信息
        /// </summary>
        public ConnectInfoModel ConnectInfo { get; set; }

        /// <summary>
        /// 路径参数信息
        /// </summary>
        public PathModel Path { get; set; }

        /// <summary>
        /// 打印机参数信息.
        /// </summary>
        public PrintModel PrintSetting { get; set; }
        /// <summary>
        /// 时间间隔参数
        /// </summary>
        public IntervalTime Interval { get; set; }

        public MainProgramParam()
        {
            ConnectInfo = new ConnectInfoModel();
            Path = new PathModel();
            PrintSetting= new PrintModel();
            Interval = new IntervalTime();
        }
    }
    #region 连接参数
    /// <summary>
    /// 数据库和通讯服务连接参数
    /// </summary>
    [XmlType(TypeName = "ConnectInfo")]
    public class ConnectInfoModel
    {
        /// <summary>
        /// 数据库参数
        /// </summary>
        public SQLServerConnectParam SQLServer { get; set; }

        public KDSQLServerConnectParam KDServer { get; set; }
    }

    /// <summary>
    /// 数据库连接参数
    /// </summary>
    [Serializable]
    public class SQLServerConnectParam
    {
        /// <summary>
        /// 数据库名称
        /// </summary>
        [XmlAttribute]
        public string Database { get; set; }
        /// <summary>
        /// 数据库源
        /// </summary>
        [XmlAttribute]
        public string DataSoure { get; set; }
        /// <summary>
        /// 数据库登录名
        /// </summary>
        [XmlAttribute]
        public string UserName { get; set; }
        /// <summary>
        /// 数据库密码
        /// </summary>
        [XmlAttribute]
        public string Password { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        public SQLServerConnectParam()
        {
            Database = string.Empty;
            DataSoure = string.Empty;
            UserName = string.Empty;
            Password = string.Empty;
        }
    }
    /// <summary>
    /// 数据库连接参数
    /// </summary>
    [Serializable]
    public class KDSQLServerConnectParam
    {
        /// <summary>
        /// 数据库名称
        /// </summary>
        [XmlAttribute]
        public string Database { get; set; }
        /// <summary>
        /// 数据库源
        /// </summary>
        [XmlAttribute]
        public string DataSoure { get; set; }
        /// <summary>
        /// 数据库登录名
        /// </summary>
        [XmlAttribute]
        public string UserName { get; set; }
        /// <summary>
        /// 数据库密码
        /// </summary>
        [XmlAttribute]
        public string Password { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        public KDSQLServerConnectParam()
        {
            Database = string.Empty;
            DataSoure = string.Empty;
            UserName = string.Empty;
            Password = string.Empty;
        }
    }
    #endregion

    #region 路径参数
    /// <summary>
    /// 文件路径参数
    /// </summary>
    public class PathModel
    {
        /// <summary>
        /// 项目数据配置文件路径
        /// </summary>
        public PathInfo ItemDataConfigAdr { get; set; }
        /// <summary>
        /// 项目自定义图像路径
        /// </summary>
        public PathInfo ItemCustomGraphAdr { get; set; }
        /// <summary>
        /// 当前url
        /// </summary>
        public PathInfo ThisURL { get; set; }
        /// <summary>
        /// 网站原始url
        /// </summary>
        public PathInfo OriginURL { get; set; }
        /// <summary>
        /// 绑定跳转url
        /// </summary>
        public PathInfo BingUrl { get; set; }


        /// <summary>
        /// 构造函数
        /// </summary>
        public PathModel()
        {
            ItemDataConfigAdr = new PathInfo();
            ItemCustomGraphAdr = new PathInfo();
            ThisURL = new PathInfo();
            OriginURL = new PathInfo();
            BingUrl = new PathInfo();

        }
    }

    /// <summary>
    /// 数据配置文件路径
    /// </summary>
    public class PathInfo
    {
        /// <summary>
        /// 路径
        /// </summary>
        [XmlAttribute]
        public string Path { get; set; }
    }
    #endregion

    #region 周期类参数
    /// <summary>
    /// 时间参数类
    /// </summary>
    public class IntervalTime
    {
        /// <summary>
        /// 线程池信息
        /// </summary>
        public TaskPoolInfo TaskPoolNum { get; set; }

        public IntervalTime()
        {
            TaskPoolNum = new TaskPoolInfo();
        }
    }
    // <summary>
    /// 线程池信息
    /// </summary>
    public class TaskPoolInfo
    {
        /// <summary>
        /// 基本数据线程池
        /// </summary>
        [XmlAttribute]
        public int BaseData { get; set; }
        /// <summary>
        /// 功能线程池
        /// </summary>
        [XmlAttribute]
        public int FunData { get; set; }
    }
    #endregion

    #region 打印机参数
    public class PrintModel
    {
        public PrintInfo PrintConfig { get; set; }

        public PrintModel()
        {
            PrintConfig = new PrintInfo();
        }
    }
    public class PrintInfo
    {
        /// <summary>
        /// 打印机地址列表.
        /// </summary>
        [XmlAttribute]
        public string IPs { get; set; }

        /// <summary>
        /// 打印机端口.
        /// </summary>
        [XmlAttribute]
        public string Port { get; set; }
    }
    #endregion
}
